package site.edody.dframe.configuration;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import site.edody.dframe.websocket.WebSocketCache;

@Order(2)
@Component
public class ConfigWsListener implements ApplicationRunner {

    private static final Logger log = LoggerFactory.getLogger(ConfigWsListener.class);

    @Value("${dframe.websocket.listener:site.edody.dframe.websocket.SampleWsListener}")
    private String listenerClass;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("set websocket listener : "+ listenerClass);
        WebSocketCache.getInstance().setListenerClass(listenerClass);
    }
}
